<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father{
            width: 400px;
            height: 400px;
            background-color: #fab;          
            display: flex;
            /* margin: 0,auto; */
            justify-content: center;
            align-items: center;
        }
        .son{
            width: 200px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son"></div>
    </div>
    <script>
        // 常见事件对象的属性和方法
        //组织事件冒泡 dom推荐的标准 stopPropagation()
        var son=document.querySelector('.son');
        son.addEventListener('click',function(e){
            alert('son');
            e.stopPropagation();//stop停止 propagation传播 i9
            e.cancelBubble=true;//cancel 取消 bubble泡泡 i678
        },false)
        var father=document.querySelector('.father');
        father.addEventListener('click',function(){
            alert('fahter');
        },false)
    </script>
</body>
</html>